Skip to content

Conversation

@tltv
Copy link
Member

@tltv tltv commented Jan 28, 2026

Adds Binder.Binding.value() to be used in field binding validators to read value of another field. The Binder automatically runs validators inside a ComponentEffect#effect context, making validators and converters reactive to signal changes.

Fixes: #23298

@tltv tltv added the signals label Jan 28, 2026
tltv added 3 commits January 29, 2026 10:09
Adds Binder.Binding.value() to be used in field binding validators to read value of another field. The Binder automatically runs validators inside a ComponentEffect#effect context, making validators and converters reactive to signal changes.

Part of #23298
@tltv tltv force-pushed the feat/binder-signal-validation branch from a0fa6ef to 2569dd3 Compare January 29, 2026 08:13
@github-actions
Copy link

github-actions bot commented Jan 29, 2026

Test Results

1 340 files  + 1  1 340 suites  +1   1h 17m 54s ⏱️ + 1m 37s
9 475 tests +25  9 407 ✅ +25  68 💤 ±0  0 ❌ ±0 
9 947 runs  +29  9 871 ✅ +29  76 💤 ±0  0 ❌ ±0 

Results for commit 8444674. ± Comparison against base commit 2f5bba4.

♻️ This comment has been updated with latest results.

Bean level validators throws Binder.InvalidSignalUsageError error when Signal.value() is called in them.

Fixes: #23364
@mshabarov mshabarov self-requested a review January 30, 2026 08:57
if (signalRegistration == null
&& getField() instanceof Component component) {
initialSignalRegistration = true;
signalRegistration = ComponentEffect.effect(component, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand, this makes validators and converters signal-reactive for validation purposes. Given that I use a signal in my converter function, what happens regarding value updates arising from a signal-triggered change?

After reading the code, seems that such updates won't make their way to fields. If so, is it intentional? Would it make sense to run converters outside of effect context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentionally running also converters inside the effect. But in practice I don't believe signals are actually used in converters. If they are, then validation reruns also on those signal value changes.
I didn't see earlier nice technical solution to leave converters out of scope here. But now I see one, it's to wrap each converter execution inside UsageTracker.untracked(...). Do you think this would make sense?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this to leave converters out, if it ends up being as simple change as it seems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update javadoc still, otherwise untracking works fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@mshabarov mshabarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments, but looks good to me and also works as expected with an example from the ticket.

* feat: add binder validation status signal

Adds Binder.getValidationStatus() method to get read-only signal for BinderValidationStatus.

Fixes: #23300

* fix single binding validation status change

* fix unresolved validation status change
@github-actions github-actions bot added +1.0.0 and removed +0.1.0 labels Feb 3, 2026
mshabarov
mshabarov previously approved these changes Feb 3, 2026
@tltv tltv requested review from mshabarov and platosha February 3, 2026 14:04
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Binder: Cross-Field validation

4 participants